import AlipaySdk from 'alipay-sdk';
import AlipayFormData from 'alipay-sdk/lib/form.js';
import dotenv from 'dotenv';

dotenv.config();

// 创建支付宝 SDK 实例
const alipaySdk = new AlipaySdk({
  appId: process.env.ALIPAY_APP_ID,
  privateKey: process.env.ALIPAY_PRIVATE_KEY,
  gateway: 'https://openapi-sandbox.dl.alipaydev.com/gateway.do', // 沙箱环境网关
  alipayPublicKey: process.env.ALIPAY_PUBLIC_KEY,
  signType: 'RSA2',
  charset: 'UTF-8'
});

export { alipaySdk, AlipayFormData }; 